home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 011 / concat.c < prev    next >
Text File  |  1985-06-03  |  1KB  |  33 lines

  1.  
  2. /* Concat will concatenate two files (file1.ext and file2.ext)
  3. into a third file (file3.ext). It's used by typing the 
  4. following command line:
  5. concat file1.ext file2.ext file3.ext
  6. */
  7.  
  8.  
  9. #define NB 80       /*  80*128 = 10K BUFSIZ     */
  10. #define CPMEOF -1
  11. #define EOF 26
  12. int ifd1,ifd2,ofd,c;
  13. char ibuf[NB*128+8], obuf[NB*128+8];
  14. main (argc,argv)
  15. char **argv;
  16. {
  17.     ifd1 = FOpenBig(argv[1], ibuf, NB);
  18.     ofd = FCreatBig(argv[3], obuf, NB);
  19.     transfer ();
  20.     close(ifd1);
  21.     ifd2 = FOpenBig(argv[2], ibuf);
  22.     transfer ();
  23.     close(ifd2);
  24.     PutcBig(EOF, obuf);
  25.     FflushBig (obuf);
  26.     close(ofd);
  27. }
  28. transfer ()
  29. {
  30.     while ((c = GetcBig(ibuf)) != EOF && c != CPMEOF)
  31.         PutcBig(c, obuf);
  32. }
  33.